﻿using System;
using System.IO;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal class HyperlinkMoniker
    {
        private Guid monikerClsid;


        private UrlData data;

        public UrlData Data
        {
            get { return data; }
            set { data = value; }
        }

        public void Read(BinaryReader reader)
        {
            this.monikerClsid = new Guid(reader.ReadBytes(16));
            if (monikerClsid.Equals(UrlMoniker.UrlClsid))
                this.data = new UrlMoniker();
            else
                throw new NotImplementedException();
            data.Read(reader);
        }

        public void Write(BinaryWriter binaryWriter)
        {
            monikerClsid = this.data.Clsid;
            binaryWriter.Write(monikerClsid.ToByteArray());
            data.Write(binaryWriter);
        }
    }
}